import java.util.TreeSet;

public class Demo4TreeSet {
    public static void main(String[] args) {
        TreeSet <String> treeSet=new TreeSet<>();

        treeSet.add("jt");
        treeSet.add("chs");
        treeSet.add("jhss");
        System.out.println(treeSet.size());
        System.out.println(treeSet); //按字母顺序打印

        Person p1=new Person("蒋恬1",200);
        Person p2=new Person("蒋恬2",201);
        Person p3=new Person("蒋恬3",203);
        TreeSet <Person> treeSet2=new TreeSet<>();
        treeSet2.add(p1);
        treeSet2.add(p2);
        treeSet2.add(p3);
        System.out.println(treeSet2);
    }
}
